package com.jojo.android.zxlib.view.preview.util;

import android.graphics.Rect;
import android.view.View;

import com.jojo.android.zxlib.view.preview.enitity.IPreviewInfo;
import com.jojo.android.zxlib.view.preview.enitity.ImageViewInfo;

import java.util.ArrayList;
import java.util.List;

/**
 * 创建者 zx
 * 创建时间 2020/12/25 11:10
 */
public class PreviewUtil {
    private final String TAG = "PreviewUtil";

    /**
     * 图片地址转换
     *
     * @param paths
     * @return
     */
    public static List<IPreviewInfo> ImagesToPreviewInfo(List<String> paths, View local) {
        if (paths == null) return null;
        List<IPreviewInfo> iPreviewInfos = new ArrayList<>();
        for (final String path : paths
        ) {
            ImageViewInfo info = new ImageViewInfo(path);
            local.getGlobalVisibleRect(info.getBounds());
            iPreviewInfos.add(info);
        }
        return iPreviewInfos;
    }

}
